package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.cucc.common.constant.LocalKeyConsts;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;

import java.util.Objects;

/**
 * 趸交资费——到期后月租属性处理类
 */
public class RentAfterUpToDateAttrHandler extends AbstractAttrHandler<KiteInst, AttrData> {
    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        super.after(attr, inst, data);
        KiteAttr upToDateDealAttr = inst.getAttr("210004553");
        if (Objects.isNull(upToDateDealAttr)) {
            return;
        }
        if (LocalKeyConsts.END_UP_IN_PERIOD_MONTHLY_RENT.equals(upToDateDealAttr.getValue())) {
            attr.setShowType(LocalKeyConsts.PROD_ATTR_SHOW_TYPE_D);
            attr.setIsNull(LocalKeyConsts.IFTRUE_F);
        }
        else {
            attr.setShowType(LocalKeyConsts.PROD_ATTR_SHOW_TYPE_E);
            attr.setIsNull(LocalKeyConsts.IFTRUE_T);
        }
    }
}
